import request from '@/utils/request'

const addressApi = {

}

/**
 * 获取地址信息分页列表
 * @param data
 * @returns {AxiosPromise}
 */
addressApi.getPageList = data => {
  return request({
    url: '/sysAddress/getPageList',
    method: 'post',
    data
  })
}

/**
 * 根据Id获取收货地址详情
 * @param data
 * @returns {AxiosPromise}
 */
addressApi.detail = id => {
  return request({
    url: '/sysAddress/selectById/' + id,
    method: 'get'
  })
}

/**
 * 批量删除
 * @param data
 * @returns {AxiosPromise}
 */
addressApi.detdeleteBatchIds = ids =>{
  return request({
    url: '/sysAddress/deleteBatchIds/' ,
    method: 'post',
    data: ids
  })
}

/**
 * 新增收货地址
 * @param data
 * @returns {AxiosPromise}
 */
addressApi.add = data => {
  return request({
    url: '/sysAddress/add',
    method: 'post',
    data
  })
}

/**
 * 修改收货地址
 * @param data
 * @returns {AxiosPromise}
 */
addressApi.update = data => {
  return request({
    url: '/sysAddress/update',
    method: 'post',
    data
  })
}

/**
 * 逻辑删除收货地址
 * @param data
 * @returns {AxiosPromise}
 */
addressApi.delete = id => {
  return request({
    url: '/sysAddress/delete/' + id,
    method: 'get'
  })
}

export default addressApi
